package com.listeningframework.boot.autoconfigure.mail.domains;

import com.listeningframework.boot.constants.MailHosts;

/**
 * 
 * Mail Message
 *
 * @author lixining
 * @version $Id: MailMessage.java, v 0.1 2015年11月4日 上午11:45:20 lixining Exp $
 */
public class ListeningMailProperties {
    /**
     * mail host
     */
    private MailHosts mailHost;
    /**
     * username
     */
    private String       username;
    /**
     * password
     */
    private String       password;
    /**
     * smtp auth
     */
    private boolean      smtpAuth = true;
    /**
     * 超时时间
     */
    private Long         timeout  = 25000L;

    public MailHosts getMailHost() {
        return mailHost;
    }

    public void setMailHost(MailHosts mailHost) {
        this.mailHost = mailHost;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public boolean isSmtpAuth() {
        return smtpAuth;
    }

    public void setSmtpAuth(boolean smtpAuth) {
        this.smtpAuth = smtpAuth;
    }

    public Long getTimeout() {
        return timeout;
    }

    public void setTimeout(Long timeout) {
        this.timeout = timeout;
    }

    public String getCacheKey() {
        StringBuffer buffer = new StringBuffer();
        buffer.append(mailHost.getCode()).append("|");
        buffer.append(username).append("|");
        buffer.append(password);
        return buffer.toString();
    }
}
